#include "mount.h"

CMount::CMount() : CObjects()
{

}

CMount::~CMount()
{

}

CMount::CMount(int Type, float X, float Y)
{
	reality = 0;
	type = Type;
	pos_x = X;
	pos_y = Y;
}

void CMount::RenderPieceMount(int P,float x,float y)
{
	if(P == 1)
		StaticPic->Render(_BackBuffer,x,y,0,1);
	else if(P == 2)
		StaticPic->Render(_BackBuffer,x,y,1,0);
	else if(P == 3)
		StaticPic->Render(_BackBuffer,x,y,1,1);
	else if(P == 4)
		StaticPic->Render(_BackBuffer,x,y,1,2);
	else if(P == 5)
		StaticPic->Render(_BackBuffer,x,y,1,3);
	else if(P == 6)
		StaticPic->Render(_BackBuffer,x,y,1,4);
}

void CMount::RenderFrame(LPDIRECT3DDEVICE9 d3ddv, int t)
{
	SpriteHandlerSP->Begin(D3DXSPRITE_ALPHABLEND);
	if(type == 1)	
	{
		RenderPieceMount(1,pos_x+2*DIS,pos_y-2*DIS);

		RenderPieceMount(2,pos_x+DIS,	pos_y-DIS);
		RenderPieceMount(3,pos_x+2*DIS,	pos_y-DIS);
		RenderPieceMount(4,pos_x+3*DIS,	pos_y-DIS);

		RenderPieceMount(2,pos_x,		pos_y);
		RenderPieceMount(3,pos_x+DIS,	pos_y);
		RenderPieceMount(5,pos_x+2*DIS,	pos_y);
		RenderPieceMount(6,pos_x+3*DIS,	pos_y);
		RenderPieceMount(4,pos_x+4*DIS,	pos_y);
	}
	else
	{
		RenderPieceMount(1,pos_x+DIS,	pos_y-DIS);

		RenderPieceMount(2,pos_x,		pos_y);
		RenderPieceMount(3,pos_x+DIS,	pos_y);
		RenderPieceMount(4,pos_x+2*DIS,	pos_y);
		
	}
	SpriteHandlerSP->End();
}